package Wires.provider;


import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

import javax.management.Query;


import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EcorePackage.Literals;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;

import Wires.AtomicModelTransformation;
import Wires.BasicData;
import Wires.CompositeTransformation;
import Wires.InputActualParameter;
import Wires.InputFormalParameter;
import Wires.Model;
import Wires.OutputActualParameter;
import Wires.OutputFormalParameter;
import Wires.Transformation;
import Wires.TransformationType;
import Wires.WiresPackage;
import Wires.impl.AtomicModelTransfomationTypeImpl;



/**
 * @generated NOT
 */	
public class EObjectPropertyDescriptor extends ItemPropertyDescriptor {
	 /**
	 * @generated NOT
	 */	  
	public EObjectPropertyDescriptor
	     (AdapterFactory adapterFactory,
	      ResourceLocator resourceLocator,
	      String displayName,
	      String description,
	      EStructuralFeature feature, 
	      boolean isSettable,
	      boolean multiLine,
	      boolean sortChoices,
	      Object staticImage,
	      String category,
	      String [] filterFlags)
	  {
		  super(  adapterFactory, resourceLocator, displayName, description, feature, 
				  isSettable, multiLine, sortChoices, staticImage, category, filterFlags);
	  }
	  
	 /**
	 * @generated NOT
	 */	
	@Override
	protected Collection<?> getComboBoxObjects(Object object)
	{
		Collection<EObject> result = new ArrayList<EObject>();
		//There is only one feature which name is metamodel
		if (this.feature.getName() == "type"){
			if (((EObject)object).eClass().equals(WiresPackage.Literals.MODEL)){
				result = getReachableObjectsOfType((EObject)object,WiresPackage.Literals.MODEL_TYPE);
			}else if (((EObject)object).eClass().equals(WiresPackage.Literals.BASIC_DATA)){
				result = getReachableObjectsOfType((EObject)object,WiresPackage.Literals.BASIC_DATA_TYPE);
			}else if (((EObject)object).eClass().equals(WiresPackage.Literals.ATOMIC_MODEL_TRANSFORMATION)){
				result = getReachableObjectsOfType((EObject)object,WiresPackage.Literals.ATOMIC_MODEL_TRANSFOMATION_TYPE);
			}else if (((EObject)object).eClass().equals(WiresPackage.Literals.COMPOSITE_TRANSFORMATION)){
				result = getReachableObjectsOfType((EObject)object,WiresPackage.Literals.COMPOSITE_TRANSFORMATION_TYPE);
			}else if (((EObject)object).eClass().equals(WiresPackage.Literals.GENERIC_TRANSFORMATION)){
				result = getReachableObjectsOfType((EObject)object,WiresPackage.Literals.ATOMIC_MODEL_TRANSFOMATION_TYPE);
			}else if (((EObject)object).eClass().equals(WiresPackage.Literals.GENERIC_QUERY)){
				result = getReachableObjectsOfType((EObject)object,WiresPackage.Literals.QUERY_TYPE);
			}else if (((EObject)object).eClass().equals(WiresPackage.Literals.QUERY)){
				result = getReachableObjectsOfType((EObject)object,WiresPackage.Literals.QUERY_TYPE);
			}else if (((EObject)object).eClass().equals(WiresPackage.Literals.MODEL2_TEXT_TRANSFORMATION)){
				result = getReachableObjectsOfType((EObject)object,WiresPackage.Literals.MODEL2_TEXT_TRANSFORMATION_TYPE);
			}else if (((EObject)object).eClass().equals(WiresPackage.Literals.OUTPUT_ACTUAL_PARAMETER)){
				//result = getReachableObjectsOfType((EObject)object,WiresPackage.Literals.OUTPUT_FORMAL_PARAMETER);
				EList<OutputFormalParameter> params = ((TransformationType)((Transformation)((OutputActualParameter) object).eContainer()).getType()).getOutParams();
				for(OutputFormalParameter p : params ){
					result.add(p);
				}
			}else if (((EObject)object).eClass().equals(WiresPackage.Literals.INPUT_ACTUAL_PARAMETER)){
				//result = getReachableObjectsOfType((EObject)object,WiresPackage.Literals.INPUT_FORMAL_PARAMETER);
				EList<InputFormalParameter> params = ((TransformationType)((Transformation)((InputActualParameter) object).eContainer()).getType()).getInParams();
				for(InputFormalParameter p : params ){
					result.add(p);
				}
			}else{
				result.add(null);
			}
		}
		return result;
	}
}